<?php

namespace app\admin\controller;
use app\admin\model\Feedback as ModelFeedback;
use frame\lib\Db;

class Feedback extends Base
{
    public function index()
    {
        $this->view();
    }
    public function list()
    {
        $query = @$_GET['feedback'];
        $list = ModelFeedback::list($query);
        success($list);
    }
    public function del()
    {
        $id = @$_GET['id'];
        if (!$id) error('缺少参数ID', 201);
        $id = explode(',', $id);
        $res = Db::name('feedback')->where(['delete_time' => 0])->whereIn('id', $id)->delete();
        if ($res) success();
        error();
    }
    public function delAll()
    {
        $res = Db::name('feedback')->where(['user_id'  => 0])->delete();
        if ($res) success();
        error();
    }
}
